const path = require('path')

const resolve = dir => {
    return path.join(__dirname, dir)
}

module.exports = {
    // publicPath:'/blog', // 二级目录名称
    outputDir: "blog", // 打包文件夹名称
    // 不检测语法
    lintOnSave: false, // 使用带有浏览器内编译器的完整构建版本 //  https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only
    runtimeCompiler: false, // babel-loader默认会跳过`node_modules`依赖. // 通过这个选项可以显示转译一个依赖
    transpileDependencies: [
        /* string or regex */
    ], // 是否为生产环境构建生成sourceMap?

    productionSourceMap: false, // 调整内部的webpack配置. // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
    // 快捷配置
    chainWebpack: config => {
        config.resolve.alias
            .set('@', resolve('src'))
            // 导入直接 @images
            .set('@images', resolve('src/assets/images'))
            .set('@forms', resolve('src/utils/data/forms'))
        // 图片获取路径 src="@images/login/logo.png"
    },
    configureWebpack: () => {}, // CSS 相关选项
    css: {
        // 是否使用css分离插件 ExtractTextPlugin
        extract: true,
        // 开启 CSS source maps?
        sourceMap: false,
        // css预设器配置项
        loaderOptions: {},
    }, // use thread-loader for babel & TS in production build // enabled by default if the machine has more than 1 cores
    pwa: {}, // configure webpack-dev-server behavior
    devServer: {
        open: process.platform === "darwin",
        disableHostCheck: false,
        host: "0.0.0.0",
        port: 8080,
        https: false,
        hotOnly: false, // See https://github.com/vuejs/vue-cli/blob/dev/docs/cli-service.md#configuring-proxy
        proxy: {
            '/django_api': {
                target: 'http://www.webzzw.xyz:8000',
                changeOrigin: true,
                ws: true,
                pathRewrite: {
                    '^/django_api': '/'
                }
            },
            // '/chat': {
            //     target: 'http://111.229.63.110:3001',
            //     changeOrigin: true,
            //     ws: true,
            //     pathRewrite: {
            //         '^/chat': '/'
            //     }
            // },
        }
        // before: app => {}
    },
    // 第三方插件配置
    pluginOptions: {
        // ...
    }
}
